/**
  ******************************************************************************
  * @file    oled_096.c
  * @author  ashuai0110
  * @version V2.3
  * @date    2024-07-01
  * @brief   0.96英寸OLED屏幕驱动
  *
  ******************************************************************************
  * @attention
  *
  * 版权声明:内容为编者(ashuai0110)原创,使用请注明出处,当然,你也可以不这样做^_^
  * 出处链接:https://gitee.com/ashuai0110/mcu_reuse_development_module.git
  *
  ******************************************************************************
  */

#ifndef __OLED_096_H
#define __OLED_096_H

#ifdef __cplusplus
extern "C" {
#endif

/* 包含头文件-----------------------------------------------------------------*/
#include "common_include.h"

/**
 * @addtogroup devices
 * @{
 */

/**
 * @addtogroup oled_096
 * @{
 */

/* 宏定义---------------------------------------------------------------------*/
/**
 * @defgroup oled_096_global_macros oled 096 global macros
 * @{
 */

#define OLED_096_WR_ADDR                    (0x78) /*!< 写地址 */
#define OLED_096_COLUMN                     (128u) /*!< 行点数 */
#define OLED_096_ROW                        (64u)  /*!< 列点数 */

/**
 * @defgroup oled_096_send_flag oled 096 send flag
 * @{
 */
#define OLED_096_SEND_CMD                   (0x00) /*!< 发送命令 */
#define OLED_096_SEND_DATA                  (0x40) /*!< 发送数据 */
/**
 * @}
 */

/**
 * @defgroup oled_096_font_size oled 096 font size
 * @{
 */
#define OLED_096_FONT_SIZE_8                (8u)  /*!< 6x8点阵 */
#define OLED_096_FONT_SIZE_16               (16u) /*!< 8x16点阵 */
/**
 * @}
 */

/**
 * @}
 */

/* 类型定义-------------------------------------------------------------------*/
/**
 * @defgroup oled_096_global_types oled 096 global types
 * @{
 */

/** 
  * @brief  oled 0.96英寸 structrue definition
  */
typedef struct oled_096 {
    void (* sclWrFn)(uint8_t level); /*!< 时钟线IO写接口 */
    void (* sdaWrFn)(uint8_t level); /*!< 数据线IO写接口 */
} oled_096_t;

/**
 * @}
 */

/* 全局变量-------------------------------------------------------------------*/

/* 函数原型-------------------------------------------------------------------*/
/**
 * @addtogroup oled_096_global_functions
 * @{
 */

void oled_096_init(oled_096_t *_oled, void (* sclWrFn)(uint8_t), void (* sdaWrFn)(uint8_t));

void oled_096_clear_display(oled_096_t *_oled);

void oled_096_show_num(oled_096_t *_oled, uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t fontSize);
void oled_096_show_num2(oled_096_t *_oled, uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t fontSize);
void oled_096_show_char(oled_096_t *_oled, uint8_t x, uint8_t y, char c, uint8_t fontSize);
void oled_096_show_string(oled_096_t *_oled, uint8_t x, uint8_t y, const char *str, uint8_t fontSize);
void oled_096_show_chinese(oled_096_t *_oled, uint8_t x, uint8_t y, uint8_t index);

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* oled_096.h */
